package com.fare.taluo.core.domain.freightprice;

import java.util.HashSet;
import java.util.Set;

import com.fare.taluo.core.domain.freightprice.em.FlightLegType;

/**
 * 航段价格实体类
 * <p>航段分单程，往返程，多段程
 * @author creator: xiangsf
 * @author modifior: xiangsf
 * @since 2012-12-25-下午4:46:39
 * @version v1.0
 */
public class FreightFlightLegEntity  {
	/**
	 * 航班
	 * <p>单程只有一个航班，往返程则有两个航班，多段有多个航班
	 */
	private Set<FreightFlightEntity> flightNos = new HashSet<FreightFlightEntity>();
	/**
	 * 航段类型,分单程，往返程，多段程
	 */
	private FlightLegType legType;
	/**
	 * 添加航班
	 * @param flightno
	 */
	public void addFlightNos(FreightFlightEntity flightno){
		this.flightNos.add(flightno);
		//两个航班，则往返，大于两个航班为多段，否则为单程
		if(this.flightNos.size() == 2){
			legType = FlightLegType.DOUBLE;
		}else if(this.flightNos.size() > 2){
			legType = FlightLegType.MULTI;
		}else{
			legType = FlightLegType.SINGLE;
		}
	}
	
	public Set<FreightFlightEntity> getFlightNos() {
		return flightNos;
	}
	public FlightLegType getLegType() {
		return legType;
	}
	
	
}
